package com.leyou.item.controller;

import com.leyou.item.pojo.Category;
import com.leyou.item.service.ICategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 品牌分类
 */
@Controller
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    private ICategoryService categoryService;

    /**
     * 根据pid查询商品列表
     * @param pid
     * @return
     */
    @RequestMapping("/list")
    @ResponseBody
    public List<Category> list(@RequestParam("pid")Long pid) throws Exception {
        return this.categoryService.findCategoryListByPid(pid);
    }
}
